data("nyc_airbnb")
airbnb = nyc_airbnb %>%
mutate(rating = review_scores_location / 2) %>%
select(neighbourhood_group, neighbourhood, rating, price, room_type, lat, long) %>%
filter(
neighbourhood_group == "Manhattan",
price %in% 100:500,
room_type == "Entire home/apt"
) %>%
drop_na(rating)
airbnb %>%
mutate(text_label = str_c("Price: $", price, "\nRating: ", rating)) %>%
plot_ly(
x = ~lat, y = ~long, color = ~price, text = ~text_label,
alpha = 0.5,
type = "scatter", mode = "markers")
airbnb %>%
mutate(neighbourhood = fct_reorder(neighbourhood, price)) %>%
plot_ly(y = ~price, x = ~neighbourhood, color = ~neighbourhood,
type = "box", colors = "viridis")
airbnb %>%
count(neighbourhood) %>%
mutate(neighbourhood = fct_reorder(neighbourhood, n)) %>%
plot_ly(x = ~neighbourhood, y = ~n, color = ~neighbourhood, type = "bar", colors = "viridis")
Avoid dashboard error: 1. rebuild website 2. use direct commandline rmarkdown::render(“dashboard.Rmd”, output_format = “flexdashboard::flex_dashboard”)